<? 
	list($filename, $ranges) = explode(":", "${_SERVER['QUERY_STRING']}");

	$file = fopen("../data/movies/The.Young.Victoria", "r"); 
	$contents = '';
	while (!feof($file)) {
  		$contents .= fread($file, 8192);
	}
	fclose($file);
	
	$contents = "<p>" . preg_replace("/([\n\r]{4})/", "</p><p>", $contents) . "</p>";
	$contents = preg_replace("/<p>(\d+)[\r\n]{2}(\d\d:\d\d:\d\d,\d\d\d[^0-9]*\d\d:\d\d:\d\d,\d\d\d)[\r\n]{0,2}/", "<p n=\"$1\" timer=\"$2\">", $contents);

	list($begin, $end) = explode(",", $ranges); 
	$n = preg_match_all("/(<p n=\"".$begin."\"[^<]*<\/p>[\s\S]*<p n=\"".$end."\"[^<]*<\/p>)/", $contents, $res);
	print $res[0][0]; 	
?>
